import React from 'react';

export default class PostDetail extends React.Component {

  constructor(props) {
    super(props);
  }

  formatter(cont) {
  	return cont;
  }

  a(ct) {
  	if(ct!=null) {
  		return <span><a href={"postlist?categoryid="+ct.category.id} >{ct.category.categoryName}</a> --> <a href={"postlist?categoryid="+ct.category.id+"&typeid="+ct.id}>{ct.name}</a></span>;
  	} else {
  		return 'loading...';
  	}
  }

  render() {
    return (
      <div className="postbodybox">
      	<div className="posttitle">{this.props.title?this.props.title:''}</div>
      	<div className="postcontext"><span dangerouslySetInnerHTML={{__html: this.props.cont}}></span></div>
      	<div className="postformmat">
      		<div className="posttime">来自 {this.a(this.props.type)} &nbsp;&nbsp;创建于：{this.props.time}&nbsp;&nbsp;<a href="">点赞</a> {this.props.good} &nbsp;|&nbsp; {this.props.read} <a href="">阅读</a></div>
      	</div>
      </div>
    );
  }
}